package com.pingan.glue.gluegame.job;

import com.pingan.glue.gluegame.common.Constant;
import com.pingan.glue.gluegame.controller.form.FilmResponse;
import com.pingan.glue.gluegame.service.GameOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Component
public class FilmUpdateJob {
    private final static Logger LOGGER = LoggerFactory.getLogger(FilmUpdateJob.class);

    @Resource
    private GameOrderService gameOrderService;


    @Scheduled(cron="10 10 * * * ?")
    public void update(){
        LOGGER.info("更新电影信息 start");
        List<FilmResponse> list = gameOrderService.film();
        Constant.FILM_RESPONSE_CATCH.clear();
        Constant.FILM_RESPONSE_CATCH.addAll(list);
        LOGGER.info("更新电影信息 end");
    }
}
